<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('支付账号列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>[[#{accountName}]]：</label>
                                <input type="text" name="accountName"/>
                            </li>
                            <li>
                                <label>[[#{bankAccountNumber}]]：</label>
                                <input type="text" name="accountNumber"/>
                            </li>
                            <li>
                                <label>[[#{bankOfDeposit}]]：</label>
                                <input type="text" name="bankName"/>
                            </li>
                            <li>
                                <label>[[#{status}]]：</label>
                                <select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
                                    <option value="">[[#{all}]]</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;[[#{search}]]</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;[[#{reset}]]</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="payment:account:add">
                    <i class="fa fa-plus"></i> [[#{add}]]
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="payment:account:edit">
                    <i class="fa fa-edit"></i> [[#{edit}]]
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="payment:account:remove">
                    <i class="fa fa-remove"></i> [[#{delete}]]
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="payment:account:export">
                    <i class="fa fa-download"></i> [[#{export}]]
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('payment:account:edit')}]];
        var removeFlag = [[${@permission.hasPermi('payment:account:remove')}]];
        var statusDatas = [[${@dict.getType('sys_normal_disable')}]];
        var prefix = ctx + "payment/account";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "支付账号",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'accountId',
                    title: '账号id',
                    visible: false
                },
                {
                    field: 'accountName',
                    title: i18n('accountName')
                },
                {
                    field: 'accountNumber',
                    title: i18n('bankAccountNumber')
                },
                {
                    field: 'bankName',
                    title: i18n('bankOfDeposit')
                },
                {
                    field: 'bankBranch',
                    title: i18n('bankBranch')
                },
                {
                    field: 'remark',
                    title: i18n("remark")
                },
                {
                    field: 'status',
                    title: i18n("status"),
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field: 'createBy',
                    title: i18n("createBy")
                },
                {
                    field: 'createTime',
                    title: i18n("createTime"),
                    sortable:true
                },
                {
                    title: i18n("operate"),
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.accountId + '\')"><i class="fa fa-edit"></i> '+i18n('edit')+'</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.accountId + '\')"><i class="fa fa-remove"></i>'+i18n('delete')+'</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
     <script th:inline="javascript">
         var ROOT = [[${#servletContext.contextPath}]];
         var LANG_COUNTRY = [[${#locale.language+'_'+#locale.country}]];

         //初始化i18n
         $.i18n.properties({
             path: ROOT + '/i18n/',//这里表示访问路径
             name: 'messages',//文件名开头
             language: LANG_COUNTRY,//文件名语言 例如en_US
             mode: 'map'//默认值
         });

         //i18n函数
         function i18n(msgKey) {
             try {
                 return $.i18n.prop(msgKey);
             } catch (e) {
                 return msgKey;
             }
         }
     </script>
</body>
</html>